package cn.yusei.teamTribe.entity;

import java.lang.reflect.Field;

public class Student {

	private int schoolId;
	private String no;
	private String name;
	private int gender;
	private String birthday;
	private String academy;
	private String major;
	private int grade;		//年级
	private int cla;		//班级
	
	public String getNo() {
		return no;
	}
	public void setNo(String no) {
		this.no = no;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getBirthday() {
		return birthday;
	}
	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}
	public int getSchoolId() {
		return schoolId;
	}
	public void setSchoolId(int schoolId) {
		this.schoolId = schoolId;
	}
	public int getGender() {
		return gender;
	}
	public void setGender(int gender) {
		this.gender = gender;
	}
	public String getAcademy() {
		return academy;
	}
	public void setAcademy(String academy) {
		this.academy = academy;
	}
	public String getMajor() {
		return major;
	}
	public void setMajor(String major) {
		this.major = major;
	}
	public int getGrade() {
		return grade;
	}
	public void setGrade(int grade) {
		this.grade = grade;
	}
	public int getCla() {
		return cla;
	}
	public void setCla(int cla) {
		this.cla = cla;
	}
	
	public void updatePublic(int isPublic)
	{
		Field[] fields = this.getClass().getDeclaredFields();
		for(int i=0; i<fields.length; i++)
		{
			if(((isPublic >> i) & 1)  == 0)
			{
				try
				{
					if(fields[i].getType().equals(int.class))
						fields[i].set(this, 0);
					else if(fields[i].getType().equals(String.class))
						fields[i].set(this, null);
				}
				catch (Exception e)
				{
					e.printStackTrace();
				}
			}
		}
	}
	
	@Override
	public String toString() {
		return "Student [schoolId=" + schoolId + ", no=" + no + ", name=" + name + ", gender=" + gender + ", birthday="
				+ birthday + ", academy=" + academy + ", major=" + major + ", grade=" + grade + ", cla=" + cla + "]";
	}
	
}
